package com.cskaoyan.controller;


import com.cskaoyan.bo.*;
import com.cskaoyan.service.UserManagementService;
import com.cskaoyan.vo.*;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("admin")
@RequiresRoles("超级管理员")
public class UserManagementController {

    @Autowired
    private UserManagementService userManagementService;


    @RequestMapping("user/list")
    public BaseRespVo users(UserBO userBO) {
        UserVO userVO = userManagementService.getUser(userBO);
        BaseRespVo ok = BaseRespVo.ok(userVO);
        return ok;
    }

    @GetMapping("history/list")
    public BaseRespVo historyList(SearchHistoryBO searchHistoryBO) {
        SearchHistoryVO searchHistoryVO = userManagementService.getSearchHistory(searchHistoryBO);
        return BaseRespVo.ok(searchHistoryVO);
    }


    @RequestMapping("address/list")
    public BaseRespVo receiveAddress(ReceiveAddressBO receiveAddressBO) {

        ReceiveAddressVO receiveAddressVO = userManagementService.getReceiveAddress(receiveAddressBO);
        BaseRespVo ok = BaseRespVo.ok(receiveAddressVO);
        return ok;
    }

    @RequestMapping("footprint/list")

    public BaseRespVo footPrint(FootPrintBO footPrintBO) {

        FootPrintVO footPrintVO = userManagementService.getFootPrint(footPrintBO);
        BaseRespVo ok = BaseRespVo.ok(footPrintVO);
        return ok;

    }


    @RequestMapping("feedback/list")
    public BaseRespVo feedbackList(FeedBackBO feedBackBO) {
        FeedbackVo feedbackVo = userManagementService.query(feedBackBO);
        return BaseRespVo.ok(feedbackVo);

    }

    //会员收藏
    @GetMapping("collect/list")
    public BaseRespVo historyList(UserCollectBO userCollectBO) {
        UserCollectVO userCollectVO = userManagementService.getUserCollect(userCollectBO);
        return BaseRespVo.ok(userCollectVO);
    }

}
